package com.bbcare.followup.plat.dto.bo;


import com.bbcare.comm.DateTimeUtil;
import com.bbcare.followup.plat.entity.DumpBreastRecord;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

public class DumpBreastSummaryVO {
    private String dayStr;
    private BigDecimal breastQuantity = new BigDecimal("0.0");
    private Integer breastCount = 0;
    List<DumpBreastRecord> rows = new ArrayList<>();

    public BigDecimal getBreastQuantity()    {return breastQuantity;}
    public void addBreastQuantity(final BigDecimal quantity) {this.breastQuantity=this.breastQuantity.add(quantity);}

    public Integer getBreastCount()    {return breastCount;}
    public void incBreastCount()    {
        breastCount++;
    }

    public String getDayStr()   {return this.dayStr;}
    public void setDayStr(final String day) {this.dayStr=day;}

    public List<DumpBreastRecord> getRows() {return this.rows;}
    public void addRow(final DumpBreastRecord row)    {this.rows.add(row);}

    public String toString()    {
        StringBuffer sb = new StringBuffer();
        sb.append("泵乳日期："+getDayStr()+"，24小时内总泵乳量(ml)："+getBreastQuantity()+"，24小时内泵乳次数："+getBreastCount()+"\n");
        int isDrug;
        String leftStartTime,rightStartTime,leftEndTime,rightEndTime;
        for(DumpBreastRecord row : getRows())   {
            isDrug = row.getIsUseDrug().intValue();
            leftStartTime   = null!=row.getLeftBreastStartTime()?DateTimeUtil.formatDate(row.getLeftBreastStartTime(),DateTimeUtil.HH_mm):"";
            leftEndTime     = null!=row.getLeftBreastEndTime()?DateTimeUtil.formatDate(row.getLeftBreastEndTime(),DateTimeUtil.HH_mm):"";
            rightStartTime  = null!=row.getRightBreastStartTime()?DateTimeUtil.formatDate(row.getRightBreastStartTime(),DateTimeUtil.HH_mm):"";
            rightEndTime    = null!=row.getRightBreastEndTime()?DateTimeUtil.formatDate(row.getRightBreastEndTime(),DateTimeUtil.HH_mm):"";
            sb.append("左开始时间："+leftStartTime+"，左结束时间："+leftEndTime+"，左泵奶量(ml)："+row.getLeftBreastQuantity()+"，右开始时间："+rightStartTime+"，右结束时间："+rightEndTime+"，右泵奶量(ml)："+row.getRightBreastQuantity()+"，是否用药："+(1==isDrug?"是":"否")+"，用药备注："+(1==isDrug?row.getUseDrugRemark():"")+"\n" );
        }
        return sb.toString();
    }
}
